using System;
using System.Windows;
using System.Windows.Data;

namespace Molic.Main
{
    /// <summary>
    /// Converts button names to icon resources.
    /// </summary>
    public class MolicBackgroundConverter : IValueConverter
    {
        public Object Convert(Object value, Type targetType, Object parameter, System.Globalization.CultureInfo culture)
        {
            String name = string.Format("{0}Icon", value);
            return Application.Current.FindResource(name);
            #region Old code
            //switch (name)
            //{
            //    case "CreateConnection":
            //        return Application.Current.FindResource("DefaultConnection");
            //    case "CreateMolicScene":
            //        return Application.Current.FindResource("MolicSceneBrush");
            //    case "CreateConversationClosingPoint":
            //        return Application.Current.FindResource("ConversationClosingPointIcon");
            //    case "CreateConversationOpenningPoint":
            //        return Application.Current.FindResource("ConversationOpeningPointIcon");
            //    case "ToggleItalic":
            //        return Application.Current.FindResource("ItalicIcon");
            //    case "ToggleUnderline":
            //        return Application.Current.FindResource("UnderlineIcon");
            //    case "AlignLeft":
            //        return Application.Current.FindResource("AlignLeftIcon");
            //    case "AlignCenter":
            //        return Application.Current.FindResource("AlignCenterIcon");
            //    case "AlignRight":
            //        return Application.Current.FindResource("AlignRightIcon");
            //    case "AlignJustify":
            //        return Application.Current.FindResource("AlignJustifyIcon");
            //    case "IncreaseIndentation":
            //        return Application.Current.FindResource("IncreaseIndentationIcon");
            //    case "DecreaseIndentation":
            //        return Application.Current.FindResource("DecreaseIndentationIcon");
            //    case "ToggleBullets":
            //        return Application.Current.FindResource("BulletsIcon");
            //    case "ToggleNumbering":
            //        return Application.Current.FindResource("NumberingIcon");
            //    case "Undo":
            //        return Application.Current.FindResource("UndoIcon");
            //    case "Redo":
            //        return Application.Current.FindResource("RedoIcon");
            //    case "Paste":
            //        return Application.Current.FindResource("PasteIcon");
            //    case "Cut":
            //        return Application.Current.FindResource("CutIcon");
            //    case "Copy":
            //        return Application.Current.FindResource("CopyIcon");
            //    case "Delete":
            //        return Application.Current.FindResource("DeleteIcon");
            //    #region File
            //    case "New":
            //        return Application.Current.FindResource("NewIcon");
            //    case "Open":
            //        return Application.Current.FindResource("OpenIcon");
            //    case "Save":
            //        return Application.Current.FindResource("SaveIcon");
            //    case "Print":
            //        return Application.Current.FindResource("PrintIcon");
            //    #endregion

            //    default:
            //        return null;
            //}
            #endregion
        }

        public Object ConvertBack(Object value, Type targetType, Object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
